<template>
  <div class="app-container" style="padding: 20px">
    <!-- 这里添加一个返回上一页的按钮 -->
      <el-button type="success" @click="goBack" plain size="normal">返回上一页</el-button>

    <el-descriptions style="margin-top:20px" class="margin-top" title="指导老师信息" :column="2" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-office-building"></i>
          头像
        </template>
        <el-image
          style="width: 100px; height: 100px"
          :src="srcTeacher"
          fit="cover"
        ></el-image>
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          姓名
        </template>
        {{ teacher.username }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-mobile-phone"></i>
          手机号
        </template>
        {{ teacher.phone }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          邮箱
        </template>
        {{ teacher.email }}
      </el-descriptions-item>
    </el-descriptions>

    <el-divider><i class="el-icon-d-caret"></i></el-divider>

    <el-descriptions class="margin-top" title="学生信息" :column="2" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-office-building"></i>
          头像
        </template>
        <el-image
          style="width: 100px; height: 100px"
          :src="student.headUrl"
          fit="cover"
        ></el-image>
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          姓名
        </template>
        {{ student.username }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-mobile-phone"></i>
          手机号
        </template>
        {{ student.phone }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          邮箱
        </template>
        {{ student.email }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          学院
        </template>
        {{ student.departmentName }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          班级
        </template>
        {{ student.fullInfo }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          实习状态
        </template>
        <el-tag type="success">已完成实习</el-tag>
      </el-descriptions-item>
    </el-descriptions>

    <el-divider><i class="el-icon-d-caret"></i></el-divider>

    <el-descriptions class="margin-top" title="工作信息" :column="2" border>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-office-building"></i>
          企业名称
        </template>
        {{ enterprise.name }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-user"></i>
          企业类型
        </template>
        <el-tag>{{ enterprise.envStr }}</el-tag>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-mobile-phone"></i>
          统一社会信用编码
        </template>
        {{ enterprise.code }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          备注信息
        </template>
        <el-tag type="danger">{{
          enterprise.memo === null ? "未填写" : enterprise.memo
        }}</el-tag>
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          个人工号
        </template>
        {{ workInfo.workCode }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          工作职位
        </template>
        <el-tag>{{ workInfo.position }}</el-tag>
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          工作开始时间
        </template>
        {{ workInfo.workStartTime }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template slot="label">
          <i class="el-icon-location-outline"></i>
          工作结束时间
        </template>
        {{ workInfo.workEndTime }}
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>

<script>
import stuWorkApi from "@/api/work";

export default {
  data() {
    return {
      student: {},
      enterprise: {},
      workInfo: {},
      teacher: {},
      srcTeacher: "",
    };
  },
  created() {
    let id = this.$route.params.id;
    stuWorkApi.getStudentAndTeacherAndEnterpriseInfo(id).then((resp) => {
      this.student = resp.data.student;
      this.teacher = resp.data.student.stringInfo;
      this.enterprise = resp.data.enterprise;
      this.workInfo = resp.data.workInfo;
      this.srcTeacher = this.teacher.headUrl;
    });
  },
  methods: {
    goBack(){
        this.$router.go(-1);
    }
  },
};
</script>

<style></style>
